package com.wanbangee.marksystem.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.wanbangee.marksystem.entities.MSubject;
import com.wanbangee.marksystem.entities.StatisticsSubReport;
import com.wanbangee.marksystem.service.MSubjectServiceApi;
import com.wanbangee.marksystem.service.StatisticsSubReportService;

@RestController
@RequestMapping("/subScore")
public class SelectSubjectReportController {
	@Autowired
	public StatisticsSubReportService statisticsSubReportService;
	
	@Autowired
	public MSubjectServiceApi mSubjectServiceApi;
	
	//查询单科成绩
	@RequestMapping(value="selectSubReportByExamIdAndClaIdAndSubIdAndStuNm",method=RequestMethod.GET)
	public Map<String,Object> selectSubjectScore(@RequestParam("examId")Integer examId,@RequestParam("subId") Integer subId, @RequestParam("claId") Integer claId,@RequestParam("stuNmOrStuNo") String stuNmOrStuNo){
		Map<String,Object> responseMap = new HashMap<String, Object>();
		List<StatisticsSubReport> statisticsSubReport = this.statisticsSubReportService.slectSubjectReportByExamIdAndSubIdAndClaIdAndstuNmOrStuNo(examId, subId, claId, stuNmOrStuNo);
		responseMap.put("message","接口成功");
		responseMap.put("code", 1001);
		 responseMap.put("StatisticsSubReport", statisticsSubReport);
		 return responseMap;
	}
	//查询考试的科目
	@RequestMapping(value="selectSubByExamId",method=RequestMethod.GET)
	public Map<String,Object> selectSubject(@RequestParam("examId")Integer examId){

		 return this.mSubjectServiceApi.selectSubject(examId);
	}
	
}
